/**
 * 
 */
package neptune.web.server.operations;

import it.robertobifulco.ias.IncorrectParamsException;
import it.robertobifulco.ias.Operation;
import neptune.web.server.ApplicationManager;
import neptune.web.server.model.ApplicationUser;
import neptune.web.server.repository.ApplicationRepository;

/**
 * @author Roberto Bifulco [info@robertobifulco.it, robertobifulco.it]
 * 
 */
public class UpdateUser implements Operation {

	public static String ID = "UpdateUser";

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#execute(java.lang.Object[])
	 */
	public Object[] execute(Object[] args) throws IncorrectParamsException,
			Exception {

		ApplicationRepository repo = ApplicationManager.getApplicationManager()
				.getApplicationRepository();
		ApplicationUser usr = (ApplicationUser) args[0];
		repo.updateUser(usr);

		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getDescription()
	 */
	public String getDescription() {
		return "Updates user data";
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getID()
	 */
	public String getID() {
		return ID;
	}

}
